package com.geekhalo.lego.core.query.support;

import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * Created by taoli on 2022/9/25.
 * gitee : https://gitee.com/litao851025/lego
 * 编程就像玩 Lego
 */
public class QueryApplicationServiceProxyFactoryBean<B>
        implements FactoryBean<B> {
    private final Class<B> queryService;

    @Autowired
    private QueryApplicationServiceProxyFactory queryServiceFactory;



    public QueryApplicationServiceProxyFactoryBean(Class queryService) {
        this.queryService = queryService;
    }

    @Override
    public B getObject() throws Exception {
        return this.queryServiceFactory.createQueryApplicationService(this.queryService);
    }

    @Override
    public Class<?> getObjectType() {
        return this.queryService;
    }

}
